package gaoji;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

public class TestThreadPool {
    public static void main(String[] args) {
        ExecutorService pool = Executors.newFixedThreadPool(10);

        MyThread myThread = new MyThread();
        pool.execute(myThread);
        pool.execute(myThread);

        pool.execute(new MyThread());
        Future<?> future = pool.submit(new MyThread());
        pool.execute(new MyThread());
        pool.execute(new MyThread());

        pool.shutdown();
    }
}

class MyThread implements Runnable {
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName());
    }
}
